package application.services;

import application.model.TypesModel;
import application.translators.Translator;
import application.translators.impl.TypesTranslator;
import dao.TypesDao;
import mappings.Types;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.List;

@Path("types")
public class TypesService
{
    private TypesDao typesDao = new TypesDao();
    private Translator<List<Types>, TypesModel> translator = new TypesTranslator();

    @Path("getAllTypes")
    @GET
    @Produces(MediaType.APPLICATION_XML)
    public TypesModel getAllTypes()
    {
        return translator.translate(typesDao.getAllTypes());
    }
}
